package com.gitee.wsl.ext.bitcode

import com.gitee.wsl.ext.string.EMPTY


/** Returns an octal string representation of this [Byte] value. */
 fun Byte.toOctalString(): String = (toInt() and 0xFF).toString(8).padStart(3, '0')

/** Returns an octal string representation of this [ByteArray] value. */
 fun ByteArray.toOctalString(): String = joinToString(String.EMPTY) { it.toOctalString() }

/** Returns an octal string representation of this [Int] value. */
 fun Int.toOctalString(): String = toString(8)

/** Returns an octal string representation of this [Long] value. */
 fun Long.toOctalString(): String = toString(8)

/** Returns an octal string representation of this [UByte] value. */
 fun UByte.toOctalString(): String = toString(8).padStart(3, '0')

/** Returns an octal string representation of this [UByteArray] value. */
@OptIn(ExperimentalUnsignedTypes::class)
 fun UByteArray.toOctalString(): String = joinToString(String.EMPTY) { it.toOctalString() }

/** Returns an octal string representation of this [UInt] value. */
 fun UInt.toOctalString(): String = toString(8)

/** Returns an octal string representation of this [ULong] value. */
 fun ULong.toOctalString(): String = toString(8)
